package cn.lianxi.mrv2._05_;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class IntSumReducer extends
		Reducer<ExpenseAccountWritable, DoubleWritable, Text, DoubleWritable> {

	Text k = new Text();
	DoubleWritable v = new DoubleWritable();

	@Override
	protected void reduce(ExpenseAccountWritable key,
			Iterable<DoubleWritable> values, Context context)
			throws IOException, InterruptedException {

		Iterator<DoubleWritable> it = values.iterator();
		while (it.hasNext()) {
			k.set(key.getSno());
			v.set(key.getCost());
			context.write(k, v);
		}
	}
}
